package org.example.service.impl;

import org.apache.commons.lang3.StringUtils;
import org.example.request.BookRequest;
import org.example.service.ValidationStrategy;
import org.springframework.stereotype.Component;

import javax.xml.bind.ValidationException;

@Component
public class AuthorValidationStrategy implements ValidationStrategy {

    @Override
    public void validate(BookRequest book) throws ValidationException {
        if (StringUtils.isBlank(book.getAuthor())) {
            throw new ValidationException("author is null");
        }
    }
}